﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.InteropServices;
using System.Windows.Interop;
using System.IO;

namespace SmallTalker
{
    /// <summary>
    /// Interaction logic for settings.xaml
    /// </summary>
    public partial class settings : Window
    {
        public settings()
        {
            InitializeComponent();
        }
        [StructLayout(LayoutKind.Sequential)]
        private struct MARGINS
        {
            public int cxLeftWidth;      // width of left border that retains its size
            public int cxRightWidth;     // width of right border that retains its size
            public int cyTopHeight;      // height of top border that retains its size
            public int cyBottomHeight;   // height of bottom border that retains its size
        };

        [DllImport("DwmApi.dll")]
        private static extern int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref MARGINS pMarInset);
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            WindowInteropHelper windowInteropHelper = new WindowInteropHelper(this);
            IntPtr myHwnd = windowInteropHelper.Handle;
            HwndSource mainWindowSrc = System.Windows.Interop.HwndSource.FromHwnd(myHwnd);

            mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 0, 0, 0);

            MARGINS margins = new MARGINS()
            {
                cxLeftWidth = -1,
                cxRightWidth = -1,
                cyBottomHeight = -1,
                cyTopHeight = -1
            };
            DwmExtendFrameIntoClientArea(myHwnd, ref margins);
            MouseDown += delegate { DragMove(); };
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Are you sure?", "SAL Question", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                MessageBox.Show("OK then!");
                if (comboBox1.Text == "Neutral Sentences")
                {
                    clearit("neutsent.txt");
                }
                else if (comboBox1.Text == "Neutral Words")
                {
                    clearit("neutralwords.txt");
                }
                else if (comboBox1.Text == "Happy Sentences")
                {
                    clearit("happysent.txt");
                }
                else if (comboBox1.Text == "Happy Words")
                {
                    clearit("happywords.txt");
                }
                else if (comboBox1.Text == "Sad Words")
                {
                    clearit("sadwords.txt");
                }
                else if (comboBox1.Text == "Sad Sentences")
                {
                    clearit("sadsent.txt");
                }
            }
        }
        public void clearit(string toclear)
        {
            StreamWriter x = new StreamWriter(toclear);
            x.Write("");
            x.Close();
        }
    }
}
